home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Peter Lewis / PNL Libraries / MyListManager.p < prev    next >
Encoding:
Text File  |  1994-04-30  |  1.3 KB  |  64 lines  |  [TEXT/PJMM]

  1. unit MyListManager;
  2.  
  3. interface
  4.  
  5.     function LCountSelections (list: ListHandle): integer;
  6.     function LHasSelection (list: ListHandle): boolean;
  7.     procedure LSetSingleSelection (list: ListHandle; v: integer);
  8.     function LPointToCell (list: ListHandle; pt: Point; var c: cell): boolean;
  9.  
  10. implementation
  11.  
  12.     function LCountSelections (list: ListHandle): integer;
  13.         var
  14.             c: Cell;
  15.             count: integer;
  16.     begin
  17.         count := 0;
  18.         c.h := 0;
  19.         c.v := 0;
  20.         while LGetSelect(true, c, list) do begin
  21.             count := count + 1;
  22.             c.v := c.v + 1;
  23.         end;
  24.         LCountSelections := count;
  25.     end;
  26.  
  27.     function LHasSelection (list: ListHandle): boolean;
  28.         var
  29.             c: Cell;
  30.     begin
  31.         c.h := 0;
  32.         c.v := 0;
  33.         LHasSelection := LGetSelect(true, c, list);
  34.     end;
  35.  
  36.     procedure LSetSingleSelection (list: ListHandle; v: integer);
  37.         var
  38.             c: Cell;
  39.     begin
  40.         c.h := 0;
  41.         c.v := v;
  42.         LSetSelect(true, c, list);
  43.         c.v := 0;
  44.         c.h := 0;
  45.         while LGetSelect(true, c, list) do begin
  46.             if c.v <> v then begin
  47.                 LSetSelect(false, c, list);
  48.             end;
  49.             c.v := c.v + 1;
  50.             c.h := 0;
  51.         end;
  52.     end;
  53.  
  54.     function LPointToCell (list: ListHandle; pt: Point; var c: cell): boolean;
  55.     begin
  56.         c.h := 0;
  57.         c.v := -1;
  58.         if PtInRect(pt, list^^.rView) then begin
  59.             c.v := list^^.visible.top + (pt.v - list^^.rView.top) div list^^.cellSize.v;
  60.         end;
  61.         LPointToCell := PtInRect(c, list^^.dataBounds);
  62.     end;
  63.  
  64. end.